clear;
WE=4;SN=2;lamda=1852;
WE=WE*lamda;
SN=SN*lamda;
alpha=1.5*pi/180;
theta=2*pi/3;
d0=-SN/2:100:SN/2;
D0=120;
ac=atan(0.5);
for j=1:359
    beta=j*pi/180;
    if beta<ac || (beta>pi-ac && beta<pi+ac) ||(beta>2*pi-ac)
        d=2*d0/abs(cos(beta));
    else
        d=d0/abs(sin(beta));
    end
    h=D0-d*sin(beta-pi/2)*tan(alpha);
    vec(1)=-1*tan(beta);
    vec(2)=1;
    vec(3)=tan(beta)*tan(alpha);
    alpha1=atan(vec(3)/(vec(1)^2+vec(2)^2+vec(3)^2)^0.5);
    cosa=abs(cos(alpha1));
    len1=cosa*h*sin(theta/2)/abs(sin(pi/2+alpha1-theta/2));
    len2=cosa*h*sin(theta/2)/abs(sin(pi/2-alpha1-theta/2));
    rate(j)=(len1(1)+len2(1))/(len1(end)+len2(end));
    if rate(j)>1
        rate(j)=1/rate(j);
    end
end
plot(1:length(rate),rate);
xlabel('测线方向夹角/°')
ylabel('宽度比')